﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
create PROCEDURE [dbo].[proc_SetEmployee_WorkDays] 
	(
	@companyid int,
	@days int,
	@month varchar(10),
	@username varchar(50)
	)
AS
BEGIN

declare @c INT
select @c = count(1) from [Employee_WorkDays] where companyid=@companyid and [month]=@month

if @c=0
begin
	 INSERT INTO [Employee_WorkDays]
           ([Companyid]
           ,[Month]
           ,[Days]
           ,[lrrq]
           ,[lrr])
     VALUES
           (@companyid
           ,@month
           ,@days
           ,getdate()
           ,@username)
end
else

update [Employee_WorkDays] set [days]=@days,udate=getdate(),xgr=@username where companyid=@companyid and [Month]=@month
           
           
           
END
